import Promise from 'bluebird';

import service from '../service/count';
import CONSTANT from '../constant/count';

// 获取统计表格列表
const getCountTableList = ({ commit }, data) => {
  const ret = new Promise((resolve, reject) => {
    const server = service.getCountTableList(data).then((res) => {
      commit(CONSTANT.COUNT_GET_TABLE_LIST_SUCCESS, res);
      return resolve(res);
    }, (e) => {
      commit(CONSTANT.COUNT_GET_TABLE_LIST_ERROR, e);
      return reject(e);
    });
    return server;
  });
  return ret;
};

export default {
  getCountTableList,
};
